home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_09
/
9n09018a
< prev
next >
Wrap
Text File
|
1991-07-07
|
789b
|
44 lines
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "linklist.h"
#define NUMELEM(a) (sizeof(a)/sizeof((a)[0]))
Node *proot_node = NULL; /* start of data list */
Node *ptail_node = NULL; /* end of data list */
Node *pfree_node = NULL; /* next free node */
unsigned int nodes_in_use = 0;
main()
{
int code;
static const void (*actions[])(void) = {
myexit,
help,
add_node,
display_node,
remove_node,
dump_asc_nodes,
dump_des_nodes,
count_nodes
};
while (1) {
printf("\nEnter Action Code (1 for help): ");
scanf("%2d", &code);
if (code < 0 || code >= NUMELEM(actions)) {
printf("\n Invalid command\n");
continue;
}
(*actions[code])(); /* call selected action */
}
}